/*
 * @Descripttion: 
 * @Author: junhuafly
 * @Date: 2020-02-26 15:19:36
 * @LastEditors: junhuafly
 * @Email: junhuafly@163.com
 * @LastEditTime: 2020-04-20 16:04:14
 */
const _version = '1.0.0'
App({
  "plugins": {
    "brickLayout": {
      "version": "0.2.0",
      "provider": "wx3c042630f3cdc175"
    }
  },
  data: {
    token: `EC-TOKEN 05WUEbIv9ECnkO1CSaN4HCTfFiRbD/kEVeA0/5dv6impg2zQ2IBaQkpyxSspV+Ion2YWpzM0RsckQn07JFgt0pc+nfVaaZ74LFhRlo386ErbUMYM9gdKPC+Iw1/v0w1z/eHnIP2wG4qqJo/BTfFYZppUT33DgZtq9GdABm3xCntxbywVyMV7QZ+SDsd5vd6j85B7HxSuYGPIq1PD416IVXUM9x1QRC9SQfKxgETr/eetlEpeC4kNqyOSF7OW6n0O90tKRxRSDR8Ms9YaBNcgpPmHs2O7VXKONlvMTE5JxSh/tx8BH1dwz248NR1X4xmY4rDyfBbpB1arWNV14PsQNymmxmSPiG4uDk0PVyw3Kikywf5tvtaOAMk+dsLAY5vrzARV7YdkDbRrCOnSvYT5b96eNV3WPYJ0diQ+cOlswtKuu38wC25GzD4TOS4lu2gQx/Fg+UlXyH0YQ+Co1K5UGTMELxcs2+tvGpXRl4DWHDU=`,
    globalParams: ''
  },
  onLaunch(options) {
    // 判断是否由分享进入小程序
    if (options.scene == 1007 || options.scene == 1008) {
      this.globalData.share = true
    } else {
      this.globalData.share = false
    };
    //获取设备顶部窗口的高度（不同设备窗口高度不一样，根据这个来设置自定义导航栏的高度）
    //这个最初我是在组件中获取，但是出现了一个问题，当第一次进入小程序时导航栏会把
    //页面内容盖住一部分,当打开调试重新进入时就没有问题，这个问题弄得我是莫名其妙
    //虽然最后解决了，但是花费了不少时间
    // wx.getSystemInfo({
    //   success: (res) => {
    //     this.globalData.height = res.statusBarHeight
    //   }
    // })
    let systemInfo = wx.getSystemInfoSync();
    
    let modellers = systemInfo.model;
    if (modellers.search('iPhone X') != -1) {
      this.globalData.isIphoneX = true
    }
    console.log('------------------------------------');
    console.log(systemInfo);
    console.log('------------------------------------');
    wx.setStorageSync('modellers', modellers)

    // let rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null; //胶囊按钮位置信息
    // wx.getMenuButtonBoundingClientRect();
    // let navBarHeight = (function () { //导航栏高度
    //   let gap = rect.top - systemInfo.statusBarHeight; //动态计算每台手机状态栏到胶囊按钮间距
    //   return 2 * gap + rect.height;
    // })();
    this.globalData.height = systemInfo.statusBarHeight
    this.globalData.width = systemInfo.screenWidth
  },
  globalData: {
    share: false, // 分享默认为false
    height: 22,
  },
  version: _version,
  setTitle(title) {
    this.globalData.title = title
    // wx.setNavigationBarTitle({
    //   title: title,
    // });
  }
})